<%@ page language="java" contentType="text/html; charset=utf8"
         pageEncoding="utf8" %>

<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c' %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>


<script type="text/javascript" src="<c:url value="/js/validator.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery.js"/>"></script>

<html>
<head>
    <title>
        PIM
    </title>

    <link rel="stylesheet" type="text/css" href="<c:url value="/css/style.css"/>">

</head>


<body>
<table align="center" border="0" cellspacing="0">
    <tr>
        <td>
            <%@include file="/WEB-INF/inc/header.jsp" %>
        </td>
    </tr>

    <tr bgcolor="#ffffff" height="800">
        <td style="padding: 40px">

            <spring:message code="login.text"/>
            <br>
            <br>

            <form method="POST" name="login"
                  action="<c:url value="/j_spring_security_check" />"
                  onsubmit="return validateForm()">

                <table align="center">
                    <tr>
                        <td align="right"><spring:message code="field.email"/></td>
                        <td><input type="text" name="j_username"/>
                        </td>


                    </tr>
                    <tr>
                        <td colspan="2">
                            <div id="email.errors"></div>
                        </td>
                    </tr>


                    <tr>
                        <td align="right"><spring:message code="field.password"/></td>
                        <td><input type="password" name="j_password"/>

                        </td>

                    </tr>

                    <tr>
                        <td colspan="2">
                            <div id="password.errors"></div>
                        </td>
                    </tr>

                    <tr>
                        <td align="right"><spring:message code="field.rememberMe"/></td>
                        <td><input type="checkbox" name="_spring_security_remember_me"/></td>
                    </tr>
                    <tr>
                        <td colspan="2" align="right"><input type="submit" class="button"
                                                             value="<spring:message code="button.enter" />"/>
                            <input type="reset" class="button" value="<spring:message code="button.clear" />"/></td>
                    </tr>
                </table>
            </form>

            <c:if test="${not empty param.error}">
                <div class="error" id="login.errors">
                    <spring:message code="login.error.message"/><br/>
                    <spring:message code="login.error.reason"/>: <c:out
                        value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/>.
                </div>
            </c:if>
            <br>

            <a href="<c:url value="/register"/>">
                <spring:message code="link.registration"/>
            </a>

        </td>
    </tr>

    <tr>
        <td>
            <%@include file="/WEB-INF/inc/footer.jsp" %>
        </td>
    </tr>

</table>


</body>
</html>
